package com.github.interview.controller;

import com.github.interview.http.Result;
import com.github.interview.model.EquityTransaction;
import com.github.interview.service.EquityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @author Stephen
 * @date 2020/6/15 15:19
 */
@RestController
@RequestMapping("/transaction")
public class EquityController {

    @Autowired
    private EquityService equityService;

    @PostMapping("/add")
    public Result addTransaction(@RequestBody @Valid EquityTransaction transaction) {

        equityService.addTransaction(transaction);
        return Result.success(null);
    }
}
